<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        body {
            background: url(images/1.jpg) no-repeat center top;
        }
        
        li {
            list-style: none;
        }
        
        .baidu {
            display: flex;
            margin: 100px auto;
            background-color: #fff;
            width: 410px;
            padding-top: 3px;
        }
        
        .baidu li {
            float: left;
            width: 100px;
            margin: 0 1px;
            cursor: pointer;
        }
        
        .baidu img {
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="baidu">
        <ul>
            <li><img src="images/1.jpg" alt=""></li>
            <li><img src="images/2.jpg" alt=""></li>
            <li><img src="images/3.jpg" alt=""></li>
            <li><img src="images/4.jpg" alt=""></li>
        </ul>
    </div>
    <script>
        var img = document.querySelector(".baidu").querySelectorAll("img");
        for (var i = 0; i < img.length; i++) {
            img[i].onclick = function() {
                document.body.style.backgroundImage = "url(" + this.src + ")";
            }
        }
    </script>
</body>

</html>